import java.awt.*;
import javax.swing.*;

public class JtableDemo extends JApplet {
    public void init() {
	Container cp = getContentPane();
	cp.setLayout(new BorderLayout());

	final String[] colHeads = {"Name", "Phone", "Age"};

	final Object[][] data = {
	     {"Lin Song", "4555555", "22"},
	     {"Jin Tao", "45511115", "20"},
	     {"Lin Song", "4555555", "22"},
	     {"Lin Song", "4555555", "22"},
	     {"Lin Song", "4555555", "22"},
	     {"Lin Song", "4555555", "22"},
	     {"Lin Song", "4555555", "22"},
	     {"Lin Song", "4555555", "22"},
	     {"Lin Song", "4555555", "22"},
	     {"Lin Song", "4555555", "22"},
	     {"Lin Song", "4555555", "22"}
	};
	JTable jt = new JTable(data, colHeads);

	int v = ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;
	int h = ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;

	JScrollPane jsp = new JScrollPane(jt, v, h);
	cp.add(jsp, BorderLayout.CENTER);
    }
}
